﻿///////////////////////////////////////////////////////////
//  Class			:	Block1.cs
//  CLRVersion		:	4.0.30319.42000
//  NameSpace		:	BenNHTetris
//  Created on		:	2018/5/31 11:41:37
//  Original author	:	JIYONGFEI 
//  JiYF笨男孩博客  :   https://www.cnblogs.com/JiYF/
///////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace BenNHTetris
{
    class Block1:Block
    {
        public Block1()
        {
            this._curChangeTimes = 0;
            this._needRows = 2;
            this._needColumns = 2;
            _range = new int[2, 2]{
                                    {1,1},
                                    {1,1} 
                                  };

            this._center = new Point(0,0);
            this._Pos = new Point();
        }

        public override bool CanChange(int[,] arr, int rows, int cloumns)
        {
            return false;
        }

        public override void Change()
        {
            return;
        }

        public override bool CanLeftMove(int[,] arr, int rows, int columns)
        {
            if (_Pos.X < 0)
            {
                if (_Pos.Y == 0 || arr[_Pos.X + 1, _Pos.Y - 1] == 1)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            if (_Pos.Y == 0 || arr[_Pos.X, _Pos.Y - 1] == 1 || arr[_Pos.X + 1, _Pos.Y - 1] == 1)
                return false;
            else
                return true;
        }

        public override bool CanRightMove(int[,] arr, int rows, int columns)
        {
            if (_Pos.X < 0)
            {
                if (_Pos.Y == columns - 2 || arr[_Pos.X + 1, _Pos.Y + 2] == 1)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            if (_Pos.Y == columns - 2 || arr[_Pos.X, _Pos.Y + 2] == 1 || arr[_Pos.X + 1, _Pos.Y + 2] == 1)
                return false;
            else
                return true;
        }

        public override bool CanDownMove(int[,] arr, int rows, int columns)
        {
            if (_Pos.X < rows - 2 && arr[_Pos.X + 2, _Pos.Y] == 0 && arr[_Pos.X + 2, _Pos.Y + 1] == 0)
                return true;
            return false;
        }

        public override int Appear()
        {
            return -1;
        }
    }
}
